package com.example.demo.zcy;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/person")
public class PersonController {

    @Resource
    private PersonService personService;

    @RequestMapping("/save")
    public String save(){
        Person person = new Person("tain" , 1123);
        personService.save(person);
        return "save ok";
    }

    @RequestMapping("/delete")
    public String delete(){
        personService.delete(10);
//        personService.getAll();
        return "delete ok";
    }


    @RequestMapping("/getAll")
    public Iterable<Person> getAll(){
        return personService.getAll();
    }



}
